#include <iostream>

using namespace std;

int arr[10] = {0};

void qsort(int s,int e){
    int i = s;
    int j = e;
    int mid = arr[(i+j) / 2];

    while (i <= j){
        while (arr[i] < mid) i++;
        while (arr[j] > mid) j--;

        if (i <= j){
            int t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
            i++,j--;
        }

    }
    if (s < j) qsort(s,j);
    if (i < e) qsort(i,e);
}




int main(){
    int i,k;
    int l = 0,r = 9;
    for (i = 0;i < 10;i++){
        cin >> arr[i];
    }

    while (l <= r){
        while (arr[l] % 2 == 1) l++;
        while (arr[r] % 2 == 0) r--;

        if (l <= r){
            int t = arr[l];
            arr[l] = arr[r];
            arr[r] = t;
            l++;r--;
        }
    }


    qsort(0,r);
    qsort(r+1,9);

    for (k = 0;k <= r;k++){
        cout << arr[r - k] << " ";
    }

    for (k = k;k <= 9;k++){
        cout << arr[k] << " ";
    }

}